import 'package:ost_flutter_module/class/entity/store/shop_cart_entity.dart';
import 'package:ost_flutter_module/class/entity/store/store_address_entity.dart';
import 'package:ost_flutter_module/class/entity/store/store_course_detail_entity.dart';
import 'package:ost_flutter_module/class/entity/store/store_home_banner_entity.dart';
import 'package:ost_flutter_module/class/entity/store/store_map_entity.dart';
import 'package:ost_flutter_module/class/entity/store/store_region_entity.dart';
import 'package:ost_flutter_module/class/entity/store/store_search_entity.dart';

class EntityFactory {
  static T generateOBJ<T>(json) {
    if (json == null) {
      return null;
    } else if (T.toString() == "StoreMapEntity") {
      return StoreMapEntity.fromJson(json) as T;
    } else if (T.toString() == "StoreHomeBannerEntity") {
      return StoreHomeBannerEntity.fromJson(json) as T;
    } else if (T.toString() == "StoreRegionEntity") {
      return StoreRegionEntity.fromJson(json) as T;
    } else if (T.toString() == "StoreSearchEntity") {
      return StoreSearchEntity.fromJson(json) as T;
    } else if (T.toString() == "StoreSearchEntityGoodsList") {
      return StoreSearchEntityGoodsList.fromJson(json) as T;
    } else if (T.toString() == "StoreSearchEntityShiftList") {
      return StoreSearchEntityShiftList.fromJson(json) as T;
    } else if (T.toString() == "StoreCourseDetailEntity") {
      return StoreCourseDetailEntity.fromJson(json) as T;
    } else if (T.toString() == "ShopCartEntity") {
      return ShopCartEntity.fromJson(json) as T;
    } else if (T.toString() == 'StoreAddressEntity') {
      return StoreAddressEntity.fromJson(json) as T;
    } else {
      return json as T;
    }
  }
}
